<template>
    <div id="home">
        <Nav class="nav" gobackpath="/" morepath="/home/more">
            <div slot="left" >×</div>
            <div slot="center">首页</div>
            <div slot="right" >···</div>
        </Nav>
        <router-view></router-view>
        <Scroll class="content" :probe-type='3' :pull-upload="true" @pullingUp="loadMore">
        <ratationChart :images="ratation"></ratationChart>
        
        <div class="static"><div class="dynamic">行内动态</div></div>
            <main-post :messages="info"></main-post>
        </Scroll>
        <main-tab-bar class="tab-bar-bottom"></main-tab-bar>
    </div>
</template>

<script>
import Nav from '@/components/common/Nav';
import ratationChart from '@/components/content/ratationChart';
import MainPost from '@/components/post/MainPost';
import Scroll from '@/components/common/scroll/Scroll.vue';
import {request} from '@/network/request.js';
import axios from 'axios';
import MainTabBar from '@/components/tabbar/MainTabBar';
// import More from './More';
    export default {
        data() {
            return {
                ratation: [],
                page:0,
                info:[]
            }
        },
        components: {
            Nav,
            ratationChart,
            MainPost,
            Scroll,
            MainTabBar
        },
        created () {
           this.getRatationData() ;
           this.getInfoIndex();
        },
        methods: {
             async getRatationData(){
                 try{
                    const res= await request({
                    url: 'api/news/index',
                    })
                    this.ratation = res.data.data;
                 }catch{
                     console.log("Ratation加载失败")
                 }
            },

            async getInfoIndex(){
                try{
                    const res = await request({
                    url: '/api/info/index',
                    })
                    this.info = res.data.data;
                 }catch{
                     console.log("加载失败")
                     
                    //  this.getInfoIndex()
                 }
            },

            loadMore(){
                this.getInfoIndex();
            }

        },
    }
</script>

<style  scoped>
#home{
    height: 100vh;
}
.dynamic{
    
    font-size: 16px;
    margin-left: 27px;
    margin-top: 18px;
    z-index: 9;
   
}
.content{
    margin-top: 64px;
    height: calc(100% - 100px);
    overflow: hidden;
}

</style>